/*
 * @Autor: dingxiaolin
 * @Date: 2021-06-02 13:12:45
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-07-22 10:24:43
 */
import http from '@/utils/http/axios'
import { type } from './interface'

/**
 * @description: 获取角色列表
 */
export function getRolePage(params) {
    return http.request<any>({
        url: `/app-admin/role/page`,
        method: 'GET',
        params
    })
}
/**
 * @description: 获取当前用户角色
 */
export function getCurrentRole(params) {
    return http.request<any>({
        url: `/app-admin/user/ownRole`,
        method: 'GET',
        params
    })
}

/**
 * 增加角色
 */
export function sysRoleAdd(params) {
    return http.request<any>({
        url: '/app-admin/role/add',
        method: 'post',
        params
    })
}

/**
 * 编辑角色
 */
export function sysRoleEdit(params) {
    return http.request<any>({
        url: '/app-admin/role/edit',
        method: 'post',
        params
    })
}

/**
 * 删除角色
 */
export function sysRoleDelete(params) {
    return http.request<any>({
        url: '/app-admin/role/delete',
        method: 'post',
        params
    })
}

/**
 * 角色详情
 */
export function sysRoleDeteil(params) {
    return http.request<any>({
        url: '/app-admin/role/detail',
        method: 'get',
        params
    })
}

/**
* 授权数据
*/
export function sysRoleGrantData(params) {
    return http.request<any>({
        url: '/app-admin/role/grantData',
        method: 'post',
        params
    })
}

/**
 * 拥有菜单
 */
export function sysRoleOwnMenu(params) {
    console.log(params)
    return http.request<any>({
        url: '/app-admin/role/ownMenu?id=' + params.id,
        method: 'get'
    })
}

/**
 * 授权菜单
 */
export function sysRoleGrantMenu(params) {
    return http.request<any>({
        url: '/app-admin/role/grantMenu',
        method: 'post',
        params
    })
}
